home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Games / SpriteFight 2002 v2.0a1 / SafariSprite.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-28  |  1.8 KB  |  55 lines  |  [TEXT/SPM ]

  1. /*******************************************************
  2. *** SafariSprite.c
  3. *** By: Stefan C. Sinclair
  4. *** Copyright © 1996 All Rights Reserved Worldwide.
  5. *** Guy Farrari's Background sprite control routines
  6. *******************************************************/
  7.  
  8. #include "SpriteBackground.h"
  9.  
  10. extern CWindowPtr    gWindowP;
  11. extern short    gFrameAdvanceTime;
  12. extern RgnHandle gWorkRgn;
  13.  
  14.  
  15. void SetupSafariSprite(SpritePtr spriteP)
  16. {
  17.     Rect tempBoundsRect, moveBoundsRect;
  18.     short horizMoveDelta;
  19.     short vertMoveDelta;
  20.     
  21.     moveBoundsRect = gWindowP->portRect;
  22.     tempBoundsRect = moveBoundsRect;
  23.     horizMoveDelta = 0;        //GetRandom(2, 6);
  24.     vertMoveDelta =    0;        //GetRandom(2, 6);
  25.     
  26.     // calculate the movement boundary rectangle
  27.     InsetRect(&tempBoundsRect, horizMoveDelta, vertMoveDelta);
  28.  
  29.     // set the sprite’s movement characteristics
  30.     SWSetSpriteMoveBounds(spriteP, &tempBoundsRect);
  31.     SWSetSpriteMoveDelta(spriteP, horizMoveDelta, vertMoveDelta);
  32.     SWSetSpriteMoveProc(spriteP, SafariMoveProc); //• mine
  33.     // Maximum Speed!!!
  34.     SWSetSpriteMoveTime(spriteP, 0); // Stationary
  35.     SWSetSpriteFrameTime(spriteP, 5*5*(20-gFrameAdvanceTime-1)); // 1/5 speed
  36.     SWSetSpriteFrameRange(spriteP, 0, 12); // 13 frames
  37.     SWSetSpriteFrameAdvance(spriteP, 1);
  38.     // Default draw proc = CopyBits
  39.     SWSetSpriteCollideProc(spriteP, SafariSpriteCollideProc); // mine
  40.     // set the sprite’s initial location
  41.     SWSetSpriteLocation(spriteP, 240, (moveBoundsRect.bottom - 200));
  42. }
  43.  
  44. // SafariSpriteCollideProc----------------------------------------------------------------
  45. void SafariSpriteCollideProc(SpritePtr srcSpriteP,SpritePtr dstSpriteP,Rect* sectRect)
  46. {
  47.     return; // bare minimum!
  48. }
  49.  
  50. /** SafariMoveProc **/
  51. // Here, reset sprite frame range as necessary depending on location.
  52. SW_FUNC void SafariMoveProc(SpritePtr srcSpriteP, Point* spritePoint)
  53. {
  54.     return; // bare minimum!
  55. }